//引入querystring模块
const qs = require('querystring');

let str = 'keyword=帽子&sid=1234&email=lisi@qq.com';

let obj = qs.parse(str);  //将查询字符串解析成对象
console.log(obj,obj.email,obj.keyword);

let obj2 = {usr:'zhangsan',age:20,sex:'男'};
let str2 = qs.stringify(obj2);  //将对象转换成查询字符串
console.log(str2);

